<!DOCTYPE html>
<html lang="en">
<head>
<title>WebView4Delphi: uWVTypeLibrary: Interface ICoreWebView2Environment3</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="PasDoc 0.16.0-snapshot">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body>
<span id="ICoreWebView2Environment3"></span><h1 class="cio">Interface ICoreWebView2Environment3</h1>
<div class="sections">
<div class="one_section"><a class="section" href="#PasDoc-Description">Description</a></div><div class="one_section"><a class="section" href="#PasDoc-Hierarchy">Hierarchy</a></div><div class="one_section">Fields</div><div class="one_section"><a class="section" href="#PasDoc-Methods">Methods</a></div><div class="one_section">Properties</div></div>
<span id="PasDoc-Description"></span><h2 class="unit">Unit</h2>
<p class="unitlink">
<a href="uWVTypeLibrary.html">uWVTypeLibrary</a></p>
<h2 class="declaration">Declaration</h2>
<p class="declaration">
<code>type ICoreWebView2Environment3 = interface(<a class="normal" href="uWVTypeLibrary.ICoreWebView2Environment2.html">ICoreWebView2Environment2</a>)</code></p>
<h2 class="description">Description</h2>
<p>
 A continuation of the ICoreWebView2Environment2 interface. </p>
<p>


<p>&lt;see href=&quot;<a href="https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environment3">https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environment3</a>&quot;&gt;See the ICoreWebView2Environment3 article.)</p>
<span id="PasDoc-Hierarchy"></span><h2 class="hierarchy">Hierarchy</h2>
<ul class="hierarchy"><li class="ancestor">IUnknown</li>
<li class="ancestor"><a class="normal" href="uWVTypeLibrary.ICoreWebView2Environment.html">ICoreWebView2Environment</a></li>
<li class="ancestor"><a class="normal" href="uWVTypeLibrary.ICoreWebView2Environment2.html">ICoreWebView2Environment2</a></li>
<li class="thisitem">ICoreWebView2Environment3</li></ul><h2 class="overview">Overview</h2>
<span id="PasDoc-Methods"></span><h3 class="summary">Methods</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Environment3.html#CreateCoreWebView2CompositionController-HWND-ICoreWebView2CreateCoreWebView2CompositionControllerCompletedHandler-">CreateCoreWebView2CompositionController</a></strong>(ParentWindow: HWND; const handler: <a href="uWVTypeLibrary.ICoreWebView2CreateCoreWebView2CompositionControllerCompletedHandler.html">ICoreWebView2CreateCoreWebView2CompositionControllerCompletedHandler</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Environment3.html#CreateCoreWebView2PointerInfo-ICoreWebView2PointerInfo-">CreateCoreWebView2PointerInfo</a></strong>(out value: <a href="uWVTypeLibrary.ICoreWebView2PointerInfo.html">ICoreWebView2PointerInfo</a>): HResult; stdcall;</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Methods</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="CreateCoreWebView2CompositionController-HWND-ICoreWebView2CreateCoreWebView2CompositionControllerCompletedHandler-"></span><code>function <strong>CreateCoreWebView2CompositionController</strong>(ParentWindow: HWND; const handler: <a href="uWVTypeLibrary.ICoreWebView2CreateCoreWebView2CompositionControllerCompletedHandler.html">ICoreWebView2CreateCoreWebView2CompositionControllerCompletedHandler</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Asynchronously create a new WebView for use with visual hosting.

<p>parentWindow is the HWND in which the app will connect the visual tree of the WebView. This will be the HWND that the app will receive pointer/ mouse input meant for the WebView (and will need to use SendMouseInput/ SendPointerInput to forward). If the app moves the WebView visual tree to underneath a different window, then it needs to call put_ParentWindow to update the new parent HWND of the visual tree.

<p>HWND_MESSAGE is not a valid parameter for `parentWindow` for visual hosting. The underlying implementation of supporting HWND_MESSAGE would break accessibility for visual hosting. This is supported in windowed WebViews - see CreateCoreWebView2Controller.

<p>Use put_RootVisualTarget on the created CoreWebView2CompositionController to provide a visual to host the browser's visual tree.

<p>It is recommended that the application set Application User Model ID for the process or the application window. If none is set, during WebView creation a generated Application User Model ID is set to root window of parentWindow. \snippet AppWindow.cpp CreateCoreWebView2Controller

<p>It is recommended that the application handles restart manager messages so that it can be restarted gracefully in the case when the app is using Edge for WebView from a certain installation and that installation is being uninstalled. For example, if a user installs Edge from Dev channel and opts to use Edge from that channel for testing the app, and then uninstalls Edge from that channel without closing the app, the app will be restarted to allow uninstallation of the dev channel to succeed. \snippet AppWindow.cpp RestartManager

<p>The app should retry `CreateCoreWebView2CompositionController` upon failure, unless the error code is `HRESULT_FROM_WIN32(ERROR_INVALID_STATE)`. When the app retries `CreateCoreWebView2CompositionController` upon failure, it is recommended that the app restarts from creating a new WebView2 Environment. If a WebView2 Runtime update happens, the version associated with a WebView2 Environment may have been removed and causing the object to no longer work. Creating a new WebView2 Environment works since it uses the latest version.

<p>WebView creation fails with `HRESULT_FROM_WIN32(ERROR_INVALID_STATE)` if a running instance using the same user data folder exists, and the Environment objects have different `EnvironmentOptions`. For example, if a WebView was created with one language, an attempt to create a WebView with a different language using the same user data folder will fail.

<p>The creation will fail with `E_ABORT` if `parentWindow` is destroyed before the creation is finished. If this is caused by a call to `DestroyWindow`, the creation completed handler will be invoked before `DestroyWindow` returns, so you can use this to cancel creation and clean up resources synchronously when quitting a thread.

<p>In rare cases the creation can fail with `E_UNEXPECTED` if runtime does not have permissions to the user data folder.

<p>CreateCoreWebView2CompositionController is supported in the following versions of Windows:

<p>- Windows 11 - Windows 10 - Windows Server 2019 - Windows Server 2016 </p>
<h6 class="description_section">Attributes</h6>
<dl class="attributes">
  <dt>GUID['{80A22AE3-BE7C-4CE2-AFE1-5A50056CDEEB}']</dt>
  <dd></dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="CreateCoreWebView2PointerInfo-ICoreWebView2PointerInfo-"></span><code>function <strong>CreateCoreWebView2PointerInfo</strong>(out value: <a href="uWVTypeLibrary.ICoreWebView2PointerInfo.html">ICoreWebView2PointerInfo</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Create an empty ICoreWebView2PointerInfo. The returned ICoreWebView2PointerInfo needs to be populated with all of the relevant info before calling SendPointerInput. </p>
</td></tr>
</table>
<hr><span class="appinfo"><em>Generated by <a href="https://pasdoc.github.io/">PasDoc 0.16.0-snapshot</a>. </em>
</span>
</body></html>
